## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%namespace file="/component/utils.html" import="link_for_user, link" />

<div class="span-24" id="branding">
  <div class="span-5">
    <div style="padding-top:20px;text-align:center;">
      <h1>${link_for_user(c.userInfo.userName, c.userInfo.author)}</a></h1>
    </div>
  </div>
  <div class="span-5">
    <div style="padding:40px 0px 0px 6px;">
	  ${link(h.url_for_home(), u'返回首页')}
	</div>
  </div>
  <div class="span-14 last">
    <div style="padding-top:40px;padding-right:10px;text-align:right;">永久域名 ${link_for_user(c.userInfo.userName)}</div>
  </div>
</div>
<div class="span-24" style="padding-top:10px;height:90%;background-color:#EFFAFF;">
  <div class="span-5">
    <div id="local">
      <div class="local_top"></div>
      <div id="blog_owner">
        <div id="blog_owner_logo"><a href="${h.url_for('home', sub_domain=c.userInfo.userName)}"><img title="${c.userInfo.author}" src="${h.url_for('/client/images/user_logo.gif')}" class="logo" alt="用户头像"/></a></div>
        <div id="blog_owner_name">${c.userInfo.author} <br><a class="profile" href="${h.url_for(controller='blog', action='profile_view', sub_domain=c.userInfo.userName)}">详细资料</a>
        </div>
      </div>
      <div id="blog_actions" style="padding-top:5px;">
        <ul>
          <li>浏览: ${c.userInfo.viewTimes + c.blogInfo.viewTimes} 次</li>
          % if c.userInfo.gender:
          <li>性别: <img title="${c.userInfo.gender == 1 and u'男' or u'女'}" src="${h.url_for('/images/icon_minigender_%s.gif'%c.userInfo.gender)}" /></li>
          % endif
          % if c.userInfo.city:
          <li>来自: ${c.userInfo.city}</li>
          % endif
        </ul>
      </div>
      % if h.auth.authorized(h.auth.is_valid_user) and c.userInfo.userName == request.environ['REMOTE_USER'] :
      <div id="blog_admin">
        <h5>我的专区</h5>
        <ul>
          <li><a href="${h.url_for(controller='post', action='new', sub_domain=c.userInfo.userName)}">发表文章</a></li>
          <li><a href="${h.url_for(controller='post', action='drafts', sub_domain=c.userInfo.userName)}">草稿 (${c.blogInfo.draftNumber})</a></li>
          <li><a class="profile" href="${h.url_for(controller='blog', action='profile_edit', sub_domain=c.userInfo.userName)}">修改我的资料</a></li>
        </ul>
      </div>
      % endif      
      <div id="blog_menu">
        <h5>文章分类</h5>
        <ul>
          <li><a href="/">全部文章 (${c.blogInfo.postNumber})</a></li>
          <%!
            from pythonblog.service.section_service import all_sections
          %>
          % for id in all_sections.keys():
          % if c.blogInfo.sectionNumbers.has_key(id):
          <% section = all_sections[id] %>
		  <li><a href="${h.url_for('section', section_path=section.path, sub_domain=c.userInfo.userName)}">${section.name} (${c.blogInfo.sectionNumbers[section.id]})</a></li>
		  % endif
		  % endfor
        </ul>
      </div>
      <div id="comments_top">
        <h5>评论排行榜</h5>
        <ul>
          % for post in c.blogInfo.topPosts:
		  <li><a href="${h.url_for(controller='post', action='view', id=post.id, sub_domain=c.userInfo.userName)}">${post.title}</a></li>
		  % endfor
        </ul>
      </div>
      <div class="local_bottom"></div>
    </div>
  </div>
  <div class="span-19 last">
    ${next.body()}
  </div>
</div>

<%def name="title()">测试网 -- ${c.userInfo.author}</%def>

<%! import datetime %>
<%def name="head()">
	${parent.head()}
	${h.stylesheet_link(h.url_for('/css/blog.css'))}	
    ${h.javascript_link(h.url_for('/js/jquery.delay.js'))}
    
</%def>
